<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<title></title>
	</head>
	<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css" />
	<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css" />
	<style type="text/css">

		#newPreview
		{
		    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
		}
		-->
		</style>
	<body>
	<div id="info"><font color="red">${info}</font></div>
	
		<form action="${ctx}/title/titleSub_create.action" method="post"  enctype="multipart/form-data">
		<input type="hidden" name="title.titleId" value="${title.titleId}"/>
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0"
			class="tab_m left">
			<tr>
				<td colspan="2" class="zctop">
					<span class="font14 zc_bt">新建子栏目项
					</span>
				</td>
			</tr>
			<tr>
				<td width="17%">
					子栏目编号：
				</td>
				<td class="w2">
					<input type="text" name="subCode" size="5" class="fl_l"/><div id="errCode"></div>
					<br />
					说明：此代码为两位，作为排序之用，在同一父栏目下的平级栏目，该代码不能重复
				</td>
			</tr>
			<tr>
				<td class="w1 left">
					上级栏目：
				</td>
				<td class="w2">
					<input type="hidden" name="titleCode" value="${titleCode }" class="fl_l"/>
					<input type="text" name="titleName" value="${titleName }" class="fl_l" readonly />					
				</td>
			</tr>
			<tr>
				<td class="w1 left">
					子栏目名称：
				</td>
				<td class="w2">
					<input type="left" id="subName" name="titleSub.subName" class="fl_l"/><div id="errName"></div>
				</td>
			</tr>
			<tr>
				<td class="w1 left" >
					子栏目注释：
				</td>
				<td class="w2">
					<input type="text" id="subNameEn" name="titleSub.subNameEn" class="fl_l"/><div id="errNameEn"></div>
				</td>
			</tr>
			
			<tr>
				<td class="w1 left" >
					子栏目类型：
				</td>
				<td class="w2">
					<select id="subType" name="titleSub.subType" class="fl_l">	    				
						<option value="0">非会员</option>
						<option value="1">会员</option>
					</select>
					<div id="errSubType"></div>
				</td>
			</tr>
			
			<tr>
				<td class="w1 left" >
					子栏目状态：
				</td>
				<td class="w2">
					<select id="subFlag" name="titleSub.subFlag" class="fl_l">	    				
						<option value="0">有效</option>
						<option value="1">无效</option>
					</select>
					<div id="errSubFlag"></div>
				</td>
			</tr>			
			
			<tr>
				<td colspan="2" class="hei_1">
				
					<input type="button" onclick="createFunc();" value="确 定" class="log_f zc_b">
						<input type="button" onclick="javascript:history.go(-1);" value="返 回" class="log_f zc_b">
				</td>
			</tr>
		</table>
		</form>
	</body>
</html>
<script type="text/javascript" src="${ctx}/scripts/commons/validation.js"></script>
<script type="text/javascript">
<!--
function createFunc(){
	var subCode = document.getElementById("subCode").value;
	var subName = document.getElementById("subName").value;
	var subNameEn = document.getElementById("subNameEn").value;
	var subType = document.getElementById("subType").value;
	var subFlag = document.getElementById("subFlag").value;

	var flag1 = /^[0-9]{2}$/;
	if(!flag1.test(subCode)){
		document.getElementById("errCode").innerHTML = "<font color='red'>编号必须是两位数字</font>";
	   return false;
	}
	if(subCode.length > 2){
		document.getElementById("errCode").innerHTML = "<font color='red'>编号必须是两位数字</font>";
	   return false;
	}
	if(subCode.length == 0 && subName.length == 0){
	   document.getElementById("errName").innerHTML = "<font color='red'>编号、名称都不能为空！</font>";
	   return false;
	}
	if(subName.length == 0 || subName == ''){
		   document.getElementById("errName").innerHTML = "<font color='red'>栏目名称不能为空</font>";
		   return false;
	}
	if(subNameEn.length == 0 || subNameEn == ''){
		   document.getElementById("errNameEn").innerHTML = "<font color='red'>栏目英文名称不能为空</font>";
		   return false;
	}
	if(subName.length > 50){
		   document.getElementById("errName").innerHTML = "<font color='red'>栏目名称不能超过50</font>";
		   return false;
	}
	if(subName.length > 0 && hasSpecialChart(subName)){
			document.getElementById("errName").innerHTML = "<font color='red'> 栏目名称不能有特殊字符!</font>";
			return false;
	}
	if(subName.length > 0 && (subCode.length == 0)){
			document.getElementById("errCode").innerHTML = "<font color='red'> 编号、名称都不能为空！</font>";
			return false;
	}
	if (subType.length == 0) {
			document.getElementById("errSubType").innerHTML = "<font color='red'> 请选择子栏目类型！</font>";
			return false;
	}
	if (subFlag.length == 0) {
			document.getElementById("errSubFlag").innerHTML = "<font color='red'> 请选择子栏目状态！</font>";
			return false;
	}	
	 document.forms[0].submit();
}
	function PreviewImg(imgFile){
	    //新的预览代码，支持 IE6、IE7。
	    var newPreview = document.getElementById("newPreview");
	    newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
	    if(imgFile.value)
  			newPreview.style.height = "71px";
		if(newPreview.innerHTML.length > 0 ){
			newPreview.innerHTML = "";
		}				
	}	
//-->
</script>
